import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path';
import postCssPxToRem from "postcss-pxtorem";
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from '@vant/auto-import-resolver';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()
    ,
    AutoImport({
      resolvers: [VantResolver()],
    }),
    Components({
      resolvers: [VantResolver()],
    }),
  ],
  base:'./',
  resolve: {
    alias: {
      "@": path.join(__dirname, "./src") // path记得引入
    }
  },
  css: {
    postcss: {
      plugins: [
        postCssPxToRem({
          rootValue: 37.5, // （设计稿/10）1rem的大小
          propList: ["*", "!border","!font-size"], // 除 border/font-size 外所有px 转 rem
        })
      ]
    }
  }
})
